
import Relay from "react-relay";

export default class CreateOrUpdateRole extends Relay.Mutation {

    static fragments = {};

    getMutation() {
        return Relay.QL`mutation { createOrUpdateRole }`;
    }

    getVariables() {
        return {
            argsInput: {
                enid:this.props.enid,
                name:this.props.name,
                pid: this.props.pid,
                description: this.props.description,
                rid:this.props.rid,
                entype:'0'
            }
        };
    }

    getFatQuery() {
        return Relay.QL`fragment on createOrUpdateRolePayload {
            createOrUpdateRole {
                errorCode
                value
                totalResult
                role{
                    pid
                    description
                    name
                    roleid{
                        rid
                        enid
                    }
                    
                    used{
                        roleId
                        phone
                        name
                    }
                }
                id
            }
        }`;
    }

    getConfigs() {
        return [{
            type: 'REQUIRED_CHILDREN',
            children: [Relay.QL`
                fragment on createOrUpdateRolePayload {
                createOrUpdateRole {
                    errorCode
                    value
                    totalResult
                    role{
                        pid
                        description
                        name
                        roleid{
                            rid
                            enid
                        }
                        
                        used{
                            roleId
                            phone
                            name
                                }
                            }
                            id
                        }
                      }
            `]
        }];
    }

}
